const fs=require("fs")
const path=require("path")


module.exports=function(obj){
    let flag=false;
    let dirPath=path.join(__dirname,"../db/user.json")
    console.log(dirPath);
    let data=fs.readFileSync(dirPath).toString()
    let dataObj=JSON.parse(data)
    try {
        for(let key of dataObj){
            // console.log(key)
            // console.log(key.user)
            // console.log(key.user+":"+obj.user_id)
            if(key.user===obj.user_id && key.pwd===obj.user_pwd) flag=true;
        }
    } catch (error) {
        console.log(error)
        return false
    }
    return flag
}